// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-07-15',
  devtools: { enabled: true },
  modules: ['@nuxt/eslint', '@nuxt/ui'],
  typescript: {
    typeCheck: true
  },
  alias: {
    'libpag': 'libpag/lib/libpag.esm.js'
  },
  vite: {
    define: {
      global: 'globalThis'
    },
    server: {
      fs: {
        allow: ['..']
      }
    },
    build: {
      rollupOptions: {
        external: ['libpag.wasm']
      }
    }
  },
  hooks: {
    'vite:extendConfig': (config) => {
      config.optimizeDeps = {
        ...(config.optimizeDeps || {}),
        exclude: [...(config.optimizeDeps?.exclude || []), 'libpag']
      }
    }
  }
})